#ifndef __MC500_SERIAL_PORT_H__
#define __MC500_SERIAL_PORT_H__
#include <stdint.h>
#include <string>
#include <memory>
#include "config.h"

namespace MC500
{

    class SerialPort
    {
    public:
        virtual ~SerialPort() = default;

        virtual ErrorCode Init(uint32_t speed) = 0;

        //发送数据
        virtual ErrorCode Send(const uint8_t *data, uint16_t len) = 0;

        //接受数据
        virtual ErrorCode Read(uint8_t *data, uint16_t buffSize, uint16_t &readCount) = 0;

        static std::shared_ptr<SerialPort> Create(const std::string &devName);

    protected:
        SerialPort(){};
    };

}; // namespace MC500

#endif
